package nowCoder;

import java.util.*;

/**
 * @Auther: zzx
 * @Date: 2024.03.24/3/24
 */
public class HJ89 {
    // 1234 1243 1324 1342 1423 1432
    // 2134 2143 3124 3142 4123 4132
    // 2314 2413 3214 3412 4213 4312
    // 2341 2431 3241 3421 4231 4321
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        List<String> list = new ArrayList<>();
        for (int i = 0; i < 4; i++) {
            String sp = sc.next();
            if ("joker".equals(sp) || "JOKER".equals(sp)){
                System.out.println("ERROR");
                return;
            }
            list.add(sp);
        }
        for (int i = 0; i < 4; i++) {
            for (int j = 0; j < 4; j++) {
                if (j != i)
                    for (int k = 0; k < 4; k++) {
                        if (k != j && k != i){
                            String[] a = new String[]{list.get(i),list.get(j),list.get(k),list.get(6-i-j-k)};
                            String[] strings = new String[7];
                            strings[0] = String.valueOf(a[0]);
                            int point = x(a,1,ll.get(a[0]),strings);
                            if (point == 24){
                                for (int l = 0; l < 7; l++) {
                                    System.out.print(strings[l]);
                                }
                                return;
                            }
                        }
                    }
            }
        }
        System.out.println("NONE");
    }
    public static int x(String[] a,int index,int sum,String[] out){
        if (index == 4){
            return sum;
        }
        Integer in = ll.get(a[index]);
        out[index*2] = String.valueOf(a[index]);
        out[index*2 - 1] = "+";
        int x = x(a, index + 1, sum + in, out);
        if (x == 24) return x;
        out[index*2 - 1] = "-";
        x = x(a,index+1,sum - in,out);
        if (x == 24) return x;
        out[index*2 - 1] = "*";
        x = x(a,index+1,sum * in,out);
        if (x == 24) return x;
        out[index*2 - 1] = "/";
        x = x(a,index+1,sum / in,out);
        if (x == 24) return x;
        return 0;
    }
    static Map<String,Integer> ll = new HashMap<>(26);
    static{
        ll.put("A",1);
        ll.put("2",2);
        ll.put("3",3);
        ll.put("4",4);
        ll.put("5",5);
        ll.put("6",6);
        ll.put("7",7);
        ll.put("8",8);
        ll.put("9",9);
        ll.put("10",10);
        ll.put("J",11);
        ll.put("Q",12);
        ll.put("K",13);
    }
}
